package tech.yangzhijie.basic.java05;

public class Java02 {
    public static void main(String[] args) {
        int[] a = new int[100];
        for (int i = 0; i < a.length; i++) {
            a[i] = ((int)(Math.random()*100))+1;
        }

        /*for (int i=0;i<a.length-1;i++){
            for(int j=0;j<a.length-1-i;j++){
                if(a[j]>a[j+1]){
                    int num = a[j];
                    a[j] = a[j+1];
                    a[j+1] = num;
                }
            }
        }*/
        for (int i=a.length-1;i>0;i--){
            for(int j=a.length-1;j>0;j--){
                if(a[j]<a[j-1]){
                    int num = a[j];
                    a[j] = a[j-1];
                    a[j-1] = num;
                }
            }
        }

        for (int i = 0; i < a.length; i++) {
            int i1 = a[i];
            System.out.print(i1+"\t");
            if(i == 25 || i== 50){
                System.out.println();
            }
        }
    }
}
